Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_default_branch: Use HEAD instead of guessing #308

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mattcen
Copy link

@mattcen mattcen commented Mar 20, 2023

Fixes #307

@mattcen
Copy link
Author

mattcen commented Mar 20, 2023

Not sure if this is t he nicest way to do things, especially with the decode() and calling head() just so we can catch it if it fails, but it feels less bad than guessing, which is what this replaces. Thoughts and comments welcome.

@jelmer
Copy link
Contributor

jelmer commented Mar 20, 2023

Rather than checking the revision that HEAD and other branches point at, you could simply check what HEAD resolves to.

See Repo.refs.follow(b'HEAD')

@mattcen
Copy link
Author

mattcen commented Mar 23, 2023

@jelmer Thanks; code updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Browsing to a repo shows the most recently updated branch, rather than the default
2 participants